﻿using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ReflexTérkép.Tests.dto;

namespace ReflexTérkép.Tests
{
    [TestClass]
    public class SimpleTypeConversionTests : TestBase
    {
        [TestMethod]
        public void Can_Map_Matching_Property_Names_With_Different_Types()
        {
            // Arrange
            const int id = 1;
            const string firstName = "Bob";
            const string lastName = "Smith";

            var dictionary = new Dictionary<string, object>
                {
                    { "Id", Double.Parse( "1.245698" ) },
                    { "FirstName", firstName },
                    { "LastName", lastName }
                };

            // Act
            var customer = ReflexMapper.Map<Person>(dictionary);

            // Assert
            Assert.IsNotNull(customer);
            Assert.IsTrue(customer.Id == id);
            Assert.IsTrue(customer.FirstName == firstName);
            Assert.IsTrue(customer.LastName == lastName);

        }
    }
}
